package Servlet;

import Bean.Flight;
import Service.FlightService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张
 * Date: 2025-03-14
 * Time: 12:05
 */
//航班信息展示
@WebServlet("/FlightDetailsServlet")
public class FlightDetailsServlet extends HttpServlet {
    private FlightService flightService = new FlightService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json;charset=utf8");
        String flightId = req.getParameter("flightId");
        Flight flight = flightService.selectByFlightId(flightId);
        req.setAttribute("flight",flight);
        req.getRequestDispatcher("flight_details.jsp").forward(req,resp);
    }
}
